import warnings
warnings.filterwarnings('ignore')
## Get data
from dataframes import final_df_dict
from sympy import *
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from ipywidgets import Output
from tqdm import tqdm
df = final_df_dict['decision'].copy()
df.dropna(inplace=True)
df430_pre = df[(df['participant.inflation'] == '430') & (df['participant.day'] < 3)]
df1012_pre = df[(df['participant.inflation'] == '1012') & (df['participant.day'] < 3)]
df430_post = df[(df['participant.inflation'] == '430') & (df['participant.day'] >= 3)]
df1012_post = df[(df['participant.inflation'] == '1012') & (df['participant.day'] >= 3)]
dfs = {'430_pre': df430_pre,
'1012_pre': df1012_pre,
'430_post': df430_post,
'1012_post': df1012_post}
## Calculate average value for each month
quantity_430_pre = np.array([])
quantity_1012_pre = np.array([])
quantity_430_post = np.array([])
quantity_1012_post = np.array([])
quantities = {}
for k, v in dfs.items():
quantities[k] = np.array([])
for n in range(1,121):
quantities[k] = np.append(quantities[k], v[f'task.{n}.player.decision'].mean())
# quantity_430_pre = np.append(quantity_430_pre, df430_pre[f'task.{n}.player.decision'].mean())
# quantity_1012_pre = np.append(quantity_1012_pre, df1012_pre[f'task.{n}.player.decision'].mean())
# quantity_430_post = np.append(quantity_430_post, df430_post[f'task.{n}.player.decision'].mean())
# quantity_1012_post = np.append(quantity_1012_post, df1012_post[f'task.{n}.player.decision'].mean())
# qs = [quantity_430_pre,quantity_1012_pre,quantity_430_post,quantity_1012_post,]
# for i in range(len(qs)):
# for n in range(1,121):
# qs[i] = np.append(qs[i], dfs[i][f'task.{n}.player.decision'].mean())
# print('quantity', len(quantity_430_pre), type(quantity_430_pre))
months = np.array([n for n in range(1,121)])
for k, v in quantities.items():
plt.errorbar(months, v, 0.3, fmt='o', label=k)
plt.legend(
loc="upper right",
)
# label=[
# '430_pre',
# '1012_pre',
# '430_post',
# '1012_post',
<matplotlib.legend.Legend at 0x24230a8e700>
df = final_df_dict['decision'].copy()
df.dropna(inplace=True)
cols430 = ['task.29.player.decision','task.30.player.decision','task.31.player.decision','task.32.player.decision',
'task.59.player.decision','task.60.player.decision','task.61.player.decision','task.62.player.decision',
'task.89.player.decision','task.90.player.decision','task.91.player.decision','task.92.player.decision',]
cols1012 = ['task.11.player.decision','task.12.player.decision','task.13.player.decision','task.14.player.decision',
'task.35.player.decision','task.36.player.decision','task.37.player.decision','task.38.player.decision',
'task.59.player.decision','task.60.player.decision','task.61.player.decision','task.62.player.decision',
'task.83.player.decision','task.84.player.decision','task.85.player.decision','task.86.player.decision',
'task.107.player.decision','task.108.player.decision','task.109.player.decision','task.110.player.decision',]
df430_pre = df[cols430][(df['participant.inflation'] == '430') & (df['participant.day'] < 3)]
df1012_pre = df[cols1012][(df['participant.inflation'] == '1012') & (df['participant.day'] < 3)]
df430_post = df[cols430][(df['participant.inflation'] == '430') & (df['participant.day'] >= 3)]
df1012_post = df[cols1012][(df['participant.inflation'] == '1012') & (df['participant.day'] >= 3)]
dfs = {'430_pre': df430_pre,
'1012_pre': df1012_pre,
'430_post': df430_post,
'1012_post': df1012_post}
# for k, v in dfs.items():
# plt.hist(v)
# plt.hist(df430_pre, df430_post)
# df430_post
plt.hist([df430_pre[cols430[1+1]],df430_post[cols430[1+1]],df430_pre[cols430[2+1]],
df430_post[cols430[2+1]]], alpha=0.5, label=['430_pre 31','430_post 31',
'430_pre 32','430_post 32'])
# plt.bar_label([df430_pre,df430_post], fontsize=20, color='navy')
# plt.hist(df430_post, alpha=0.5, label='430_post')
plt.legend(loc='upper right')
plt.show()
plt.hist([df430_pre[cols430[5+1]],df430_post[cols430[5+1]],df430_pre[cols430[6+1]],
df430_post[cols430[6+1]]], alpha=0.5, label=['430_pre 61','430_post 61',
'430_pre 62','430_post 62'])
# plt.bar_label([df430_pre,df430_post], fontsize=20, color='navy')
# plt.hist(df430_post, alpha=0.5, label='430_post')
plt.legend(loc='upper right')
plt.show()
plt.hist([df430_pre[cols430[10]],df430_post[cols430[10]],df430_pre[cols430[11]],
df430_post[cols430[11]]], alpha=0.5, label=['430_pre 91','430_post 91',
'430_pre 92','430_post 92'])
# plt.bar_label([df430_pre,df430_post], fontsize=20, color='navy')
# plt.hist(df430_post, alpha=0.5, label='430_post')
plt.legend(loc='upper right')
plt.show()
plt.hist([df1012_pre[cols1012[1]],df1012_post[cols1012[1]],df1012_pre[cols1012[2]],
df1012_post[cols1012[2]]], alpha=0.5, label=['1012_pre 12','1012_post 12',
'1012_pre 13','1012_post 13'])
plt.legend(loc='upper right')
plt.show()
(442, 126) (442, 126) (117, 12) (115, 20) (105, 12) (105, 20)
est = final_df_dict['inf_estimate'].copy()
inf_1012 = [0.45, 60.79, 0.45, 60.79, 0.45, 60.79, 0.45, 60.79, 0.45, 60.79]
inf_430 = [0.38, 0.47, 26.85, 55.49, 64.18, 0.38, 0.47, 26.85, 55.49, 64.18]
rev_1012 = [x[1] - x[0] for x in zip(inf_1012, inf_1012[1:])]
rev_430 = [x[1] - x[0] for x in zip(inf_430, inf_430[1:])]
for n in range(2,11):
est[f'{12 * n}-{12 * (n - 1)}'] = est[f'task.{n * 12}.player.inf_estimate'] -\
est[f'task.{(n - 1) * 12}.player.inf_estimate']
est['revisions'] = np.nan
for i in range(len(est)):
x = 0
for n in range(2,11):
if est[f'{12 * n}-{12 * (n - 1)}'].iloc[i] != 0:
x += 1
else:
pass
est['revisions'].iloc[i] = x
## Graph estimates
cols = [c for c in est.columns.to_list() if ('task.' in c)]
fig, ax = plt.subplots(figsize=(24, 10))
## Actual inflation
## 10x12 pre
df = est[cols][
(est['participant.inflation'] == '1012') & (est['participant.day'] < 3) & (
est['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '10x12 pre'
df.columns = df_cols
df.plot(ax=ax, color='r', alpha=0.1)
# ax.get_legend().remove()
## 10x12 post
df = est[cols][
(est['participant.inflation'] == '1012') & (est['participant.day'] >= 3) & (
est['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '10x12 post'
df.columns = df_cols
df.plot(ax=ax, color='b', alpha=0.1)
# ax.get_legend().remove()
plt.axhline(y=60.79, color='g', linestyle=':', label='max inflation')
plt.axhline(y=0, color='black', linestyle='-')
plt.plot(inf_1012, color='#f2f542', linewidth=4, label='actual inflation')
plt.legend(loc = 'upper left')
plt.title('10x12 perceptions')
fig, ax = plt.subplots(figsize=(24, 10))
## 4x30 pre
df = est[cols][
(est['participant.inflation'] == '430') & (est['participant.day'] < 3) & (
est['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '4x30 pre'
df.columns = df_cols
df.plot(ax=ax, color='r', alpha=0.1)
# ax.get_legend().remove()
## 4x30 post
df = est[cols][
(est['participant.inflation'] == '430') & (est['participant.day'] >= 3) & (
est['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '4x30 post'
df.columns = df_cols
df.plot(ax=ax, color='b', alpha=0.1)
# ax.get_legend().remove()
plt.axhline(y=64.18, color='g', linestyle=':', label='max inflation')
plt.axhline(y=0, color='black', linestyle='-')
plt.plot(inf_430, color='#f2f542', linewidth=4, label='actual inflation')
plt.legend(loc = 'upper left')
plt.title('4x30 perceptions')
## Graph revisions
cols = [c for c in est.columns.to_list() if ('-' in c)]
fig, ax = plt.subplots(figsize=(24, 10))
## 10x12 pre
df = est[cols][
(est['participant.inflation'] == '1012') & (est['participant.day'] < 3) & (
est['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '10x12 pre'
df.columns = df_cols
df.plot(ax=ax, color='r', alpha=0.1)
# ax.get_legend().remove()
## 10x12 post
df = est[cols][
(est['participant.inflation'] == '1012') & (est['participant.day'] >= 3) & (
est['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '10x12 post'
df.columns = df_cols
df.plot(ax=ax, color='b', alpha=0.1)
# ax.get_legend().remove()
plt.axhline(y=60.79, color='g', linestyle=':', label='max inflation')
plt.axhline(y=0, color='black', linestyle='-')
plt.plot(rev_1012, color='#f2f542', linewidth=4, label='correct revision')
plt.legend(loc = 'upper left')
plt.title('10x12 revisions')
fig, ax = plt.subplots(figsize=(24, 10))
## 4x30 pre
df = est[cols][
(est['participant.inflation'] == '430') & (est['participant.day'] < 3) & (
est['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '4x30 pre'
df.columns = df_cols
df.plot(ax=ax, color='r', alpha=0.1)
# ax.get_legend().remove()
## 4x30 post
df = est[cols][
(est['participant.inflation'] == '430') & (est['participant.day'] >= 3) & (
est['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '4x30 post'
df.columns = df_cols
df.plot(ax=ax, color='b', alpha=0.1)
# ax.get_legend().remove()
plt.axhline(y=64.18, color='g', linestyle=':', label='max inflation')
plt.axhline(y=0, color='black', linestyle='-')
plt.plot(rev_430, color='#f2f542', linewidth=4, label='correct revision')
plt.legend(loc = 'upper left')
plt.title('4x30 revisions')
Text(0.5, 1.0, '4x30 revisions')
def fft_row_magnitudes(row):
fft = np.fft.fft(row)
magnitudes = np.abs(fft)
# power_spectrum = np.abs(fft)**2
est['estimate'] = ''
## Create columns for lists of estimates
for i in range(len(est)):
estimate = est.iloc[i].to_list()
estimate = estimate[6:15]
# ## Convert stock values to int
# stock = [int(i) for i in stock]
est['estimate'].iloc[i] = estimate
est['fft_magnitudes'] = ''
for i in range(len(est)):
fft = np.fft.fft(est['estimate'].iloc[i])
est['fft_magnitudes'].iloc[i] = np.abs(fft)
# power_spectrum = np.abs(fft)**2
# est['fft_magnitudes'] = est['estimate'].apply(fft_row_magnitudes)
## Frequencies of each curve
N = len(est['fft_magnitudes'].iloc[1]) # length of the magnitude list
sampling_rate = 1 # assuming a sampling rate of 1
frequencies = [(i / N) * sampling_rate for i in range(N)]
periodicities = [1 / i for i in frequencies if i != 0]
print(frequencies, len(frequencies))
print(periodicities, len(frequencies))
N = len(est['fft_magnitudes'].iloc[2]) # length of the magnitude list
sampling_rate = 1 # assuming a sampling rate of 1
frequencies = [(i / N) * sampling_rate for i in range(N)]
periodicities = [1 / i for i in frequencies if i != 0]
print(frequencies, len(frequencies))
print(periodicities, len(frequencies))
[0.0, 0.1111111111111111, 0.2222222222222222, 0.3333333333333333, 0.4444444444444444, 0.5555555555555556, 0.6666666666666666, 0.7777777777777778, 0.8888888888888888] 9 [9.0, 4.5, 3.0, 2.25, 1.7999999999999998, 1.5, 1.2857142857142856, 1.125] 9 [0.0, 0.1111111111111111, 0.2222222222222222, 0.3333333333333333, 0.4444444444444444, 0.5555555555555556, 0.6666666666666666, 0.7777777777777778, 0.8888888888888888] 9 [9.0, 4.5, 3.0, 2.25, 1.7999999999999998, 1.5, 1.2857142857142856, 1.125] 9
cols = [c for c in est.columns.to_list() if ('task.' in c)]
fig, ax = plt.subplots(figsize=(20,20))
df1 = est[cols][(est['participant.inflation'] == '430') & (
est['participant.day'] < 3
)]
df1.hist(ax=ax, color='r', label='pre')
fig, ax = plt.subplots(figsize=(20,20))
# ax = fig.gca()
df2 = est[cols][(est['participant.inflation'] == '430') & (
est['participant.day'] >= 3
)]
df2.hist(ax=ax, color='b', label='post')
# ax.legend(loc='upper right')
# plt.show()
fig, ax = plt.subplots(figsize=(20,20))
df1 = est[cols][(est['participant.inflation'] == '1012') & (
est['participant.day'] < 3
)]
df1.hist(ax=ax, color='r', label='pre')
fig, ax = plt.subplots(figsize=(20,20))
# ax = fig.gca()
df2 = est[cols][(est['participant.inflation'] == '1012') & (
est['participant.day'] >= 3
)]
df2.hist(ax=ax, color='b', label='post')
array([[<AxesSubplot:title={'center':'task.12.player.inf_estimate'}>,
<AxesSubplot:title={'center':'task.24.player.inf_estimate'}>,
<AxesSubplot:title={'center':'task.36.player.inf_estimate'}>],
[<AxesSubplot:title={'center':'task.48.player.inf_estimate'}>,
<AxesSubplot:title={'center':'task.60.player.inf_estimate'}>,
<AxesSubplot:title={'center':'task.72.player.inf_estimate'}>],
[<AxesSubplot:title={'center':'task.84.player.inf_estimate'}>,
<AxesSubplot:title={'center':'task.96.player.inf_estimate'}>,
<AxesSubplot:title={'center':'task.108.player.inf_estimate'}>],
[<AxesSubplot:title={'center':'task.120.player.inf_estimate'}>,
<AxesSubplot:>, <AxesSubplot:>]], dtype=object)
exp = final_df_dict['inf_expectation'].copy()
inf_1012 = [60.79, 0.45, 60.79, 0.45, 60.79, 0.45, 60.79, 0.45, 60.79]
inf_430 = [0.47, 26.85, 55.49, 64.18, 0.38, 0.47, 26.85, 55.49, 64.18]
rev_1012 = [x[1] - x[0] for x in zip(inf_1012, inf_1012[1:])]
rev_430 = [x[1] - x[0] for x in zip(inf_430, inf_430[1:])]
for n in range(2,10):
exp[f'{12 * n}-{12 * (n - 1)}'] = exp[f'task.{n * 12}.player.inf_expectation'] -\
exp[f'task.{(n - 1) * 12}.player.inf_expectation']
exp['revisions'] = np.nan
for i in range(len(exp)):
x = 0
for n in range(2,10):
if exp[f'{12 * n}-{12 * (n - 1)}'].iloc[i] != 0:
x += 1
else:
pass
exp['revisions'].iloc[i] = x
## Graph expimates
cols = [c for c in exp.columns.to_list() if ('task.' in c)]
fig, ax = plt.subplots(figsize=(24, 10))
## Actual inflation
## 10x12 pre
df = exp[cols][
(exp['participant.inflation'] == '1012') & (exp['participant.day'] < 3) & (
exp['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '10x12 pre'
df.columns = df_cols
df.plot(ax=ax, color='r', alpha=0.1)
# ax.get_legend().remove()
## 10x12 post
df = exp[cols][
(exp['participant.inflation'] == '1012') & (exp['participant.day'] >= 3) & (
exp['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '10x12 post'
df.columns = df_cols
df.plot(ax=ax, color='b', alpha=0.1)
# ax.get_legend().remove()
plt.axhline(y=60.79, color='g', linestyle=':', label='max inflation')
plt.axhline(y=0, color='black', linestyle='-')
plt.plot(inf_1012, color='#f2f542', linewidth=4, label='actual inflation')
plt.legend(loc = 'upper left')
plt.title('10x12 expectations')
fig, ax = plt.subplots(figsize=(24, 10))
## 4x30 pre
df = exp[cols][
(exp['participant.inflation'] == '430') & (exp['participant.day'] < 3) & (
exp['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '4x30 pre'
df.columns = df_cols
df.plot(ax=ax, color='r', alpha=0.1)
# ax.get_legend().remove()
## 4x30 post
df = exp[cols][
(exp['participant.inflation'] == '430') & (exp['participant.day'] >= 3) & (
exp['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '4x30 post'
df.columns = df_cols
df.plot(ax=ax, color='b', alpha=0.1)
# ax.get_legend().remove()
plt.axhline(y=64.18, color='g', linestyle=':', label='max inflation')
plt.axhline(y=0, color='black', linestyle='-')
plt.plot(inf_430, color='#f2f542', linewidth=4, label='actual inflation')
plt.legend(loc = 'upper left')
plt.title('4x30 expectations')
## Graph revisions
cols = [c for c in exp.columns.to_list() if ('-' in c)]
fig, ax = plt.subplots(figsize=(24, 10))
## 10x12 pre
df = exp[cols][
(exp['participant.inflation'] == '1012') & (exp['participant.day'] < 3) & (
exp['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '10x12 pre'
df.columns = df_cols
df.plot(ax=ax, color='r', alpha=0.1)
# ax.get_legend().remove()
## 10x12 post
df = exp[cols][
(exp['participant.inflation'] == '1012') & (exp['participant.day'] >= 3) & (
exp['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '10x12 post'
df.columns = df_cols
df.plot(ax=ax, color='b', alpha=0.1)
# ax.get_legend().remove()
plt.axhline(y=60.79, color='g', linestyle=':', label='max inflation')
plt.axhline(y=0, color='black', linestyle='-')
plt.plot(rev_1012, color='#f2f542', linewidth=4, label='actual inflation')
plt.legend(loc = 'upper left')
plt.title('10x12 revisions')
fig, ax = plt.subplots(figsize=(24, 10))
## 4x30 pre
df = exp[cols][
(exp['participant.inflation'] == '430') & (exp['participant.day'] < 3) & (
exp['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '4x30 pre'
df.columns = df_cols
df.plot(ax=ax, color='r', alpha=0.1)
# ax.get_legend().remove()
## 4x30 post
df = exp[cols][
(exp['participant.inflation'] == '430') & (exp['participant.day'] >= 3) & (
exp['revisions'] >= 0
)
].T
df_cols = ['_' + str(col) for col in df.columns]
df_cols[0] = '4x30 post'
df.columns = df_cols
df.plot(ax=ax, color='b', alpha=0.1)
# ax.get_legend().remove()
plt.axhline(y=64.18, color='g', linestyle=':', label='max inflation')
plt.axhline(y=0, color='black', linestyle='-')
plt.plot(rev_430, color='#f2f542', linewidth=4, label='actual inflation')
plt.legend(loc = 'upper left')
plt.title('4x30 revisions')
Text(0.5, 1.0, '4x30 revisions')
cols = [c for c in exp.columns.to_list() if ('task.' in c)]
fig, ax = plt.subplots(figsize=(20,20))
df1 = exp[cols][(exp['participant.inflation'] == '430') & (
exp['participant.day'] < 3
)]
df1.hist(ax=ax, color='r', label='pre')
fig, ax = plt.subplots(figsize=(20,20))
# ax = fig.gca()
df2 = exp[cols][(exp['participant.inflation'] == '430') & (
exp['participant.day'] >= 3
)]
df2.hist(ax=ax, color='b', label='post')
# ax.legend(loc='upper right')
# plt.show()
fig, ax = plt.subplots(figsize=(20,20))
df1 = exp[cols][(exp['participant.inflation'] == '1012') & (
exp['participant.day'] < 3
)]
df1.hist(ax=ax, color='r', label='pre')
fig, ax = plt.subplots(figsize=(20,20))
# ax = fig.gca()
df2 = exp[cols][(exp['participant.inflation'] == '1012') & (
exp['participant.day'] >= 3
)]
df2.hist(ax=ax, color='b', label='post')
array([[<AxesSubplot:title={'center':'task.12.player.inf_expectation'}>,
<AxesSubplot:title={'center':'task.24.player.inf_expectation'}>,
<AxesSubplot:title={'center':'task.36.player.inf_expectation'}>],
[<AxesSubplot:title={'center':'task.48.player.inf_expectation'}>,
<AxesSubplot:title={'center':'task.60.player.inf_expectation'}>,
<AxesSubplot:title={'center':'task.72.player.inf_expectation'}>],
[<AxesSubplot:title={'center':'task.84.player.inf_expectation'}>,
<AxesSubplot:title={'center':'task.96.player.inf_expectation'}>,
<AxesSubplot:title={'center':'task.108.player.inf_expectation'}>]],
dtype=object)
plt.subplots()
est['revisions'][(est['participant.inflation'] == '1012') & (
est['participant.day'] < 3
)].hist(color='r', label='10x12 pre-intervention')
est['revisions'][(est['participant.inflation'] == '1012') & (
est['participant.day'] >= 3
)].hist(color='b', alpha = 0.4, label='10x12 post-intervention')
plt.legend(loc='upper left')
plt.subplots()
est['revisions'][(est['participant.inflation'] == '430') & (
est['participant.day'] < 3
)].hist(color='r', label='4x30 pre-intervention')
est['revisions'][(est['participant.inflation'] == '430') & (
est['participant.day'] >= 3
)].hist(color='b', alpha = 0.4, label='4x30 post-intervention')
plt.legend(loc='upper left')
<matplotlib.legend.Legend at 0x24229b8d910>
cols = [c for c in est.columns.to_list() if ('task.' not in c) and ('.day' not in c)]
est[cols].groupby(['participant.inflation', est['participant.day'] < 3]).describe().T
| participant.inflation | 1012 | 430 | |||
|---|---|---|---|---|---|
| participant.day | False | True | False | True | |
| 24-12 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | 18.857143 | 18.212389 | 0.219048 | 1.598214 | |
| std | 23.566774 | 23.042837 | 6.062148 | 15.138674 | |
| min | -23.000000 | -67.000000 | -37.000000 | -48.000000 | |
| 25% | 2.000000 | 4.000000 | 0.000000 | 0.000000 | |
| 50% | 8.000000 | 9.000000 | 0.000000 | 0.000000 | |
| 75% | 39.000000 | 37.000000 | 2.000000 | 2.000000 | |
| max | 83.000000 | 78.000000 | 24.000000 | 97.000000 | |
| 36-24 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | -12.704762 | -10.185841 | 7.933333 | 8.660714 | |
| std | 26.516658 | 24.050374 | 10.560509 | 14.832733 | |
| min | -83.000000 | -74.000000 | -16.000000 | -82.000000 | |
| 25% | -23.000000 | -20.000000 | 1.000000 | 1.000000 | |
| 50% | -2.000000 | -2.000000 | 4.000000 | 6.000000 | |
| 75% | 2.000000 | 4.000000 | 13.000000 | 15.000000 | |
| max | 46.000000 | 54.000000 | 62.000000 | 64.000000 | |
| 48-36 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | 15.380952 | 14.761062 | 8.361905 | 6.464286 | |
| std | 22.322109 | 24.226341 | 15.699169 | 19.043775 | |
| min | -21.000000 | -54.000000 | -47.000000 | -137.000000 | |
| 25% | 1.000000 | 1.000000 | 1.000000 | 0.000000 | |
| 50% | 5.000000 | 7.000000 | 4.000000 | 5.000000 | |
| 75% | 20.000000 | 27.000000 | 17.000000 | 12.250000 | |
| max | 67.000000 | 95.000000 | 46.000000 | 85.000000 | |
| 60-48 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | -12.895238 | -9.398230 | 6.466667 | 10.776786 | |
| std | 25.139581 | 26.335588 | 18.812877 | 23.533648 | |
| min | -66.000000 | -80.000000 | -58.000000 | -59.000000 | |
| 25% | -20.000000 | -20.000000 | -1.000000 | 0.000000 | |
| 50% | -4.000000 | -3.000000 | 2.000000 | 4.000000 | |
| 75% | 1.000000 | 2.000000 | 10.000000 | 15.250000 | |
| max | 50.000000 | 65.000000 | 91.000000 | 159.000000 | |
| 72-60 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | 14.333333 | 11.548673 | -14.704762 | -14.035714 | |
| std | 22.759050 | 24.433946 | 24.297406 | 28.418979 | |
| min | -38.000000 | -50.000000 | -99.000000 | -96.000000 | |
| 25% | 1.000000 | -1.000000 | -21.000000 | -24.250000 | |
| 50% | 6.000000 | 5.000000 | -5.000000 | -6.500000 | |
| 75% | 21.000000 | 21.000000 | 0.000000 | 1.250000 | |
| max | 70.000000 | 99.000000 | 19.000000 | 59.000000 | |
| 84-72 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | -12.323810 | -12.309735 | 0.342857 | -1.419643 | |
| std | 24.349418 | 23.700919 | 9.212062 | 20.052920 | |
| min | -73.000000 | -98.000000 | -45.000000 | -161.000000 | |
| 25% | -20.000000 | -23.000000 | -1.000000 | -4.250000 | |
| 50% | -3.000000 | -4.000000 | 0.000000 | 0.000000 | |
| 75% | 1.000000 | 2.000000 | 2.000000 | 3.000000 | |
| max | 49.000000 | 34.000000 | 35.000000 | 46.000000 | |
| 96-84 | count | 105.000000 | 112.000000 | 105.000000 | 112.000000 |
| mean | 18.485714 | 18.205357 | 6.009524 | 6.455357 | |
| std | 25.223659 | 25.981330 | 15.573335 | 15.659029 | |
| min | -25.000000 | -27.000000 | -90.000000 | -53.000000 | |
| 25% | 0.000000 | 0.000000 | 0.000000 | 0.000000 | |
| 50% | 8.000000 | 10.500000 | 2.000000 | 4.500000 | |
| 75% | 31.000000 | 29.250000 | 13.000000 | 14.000000 | |
| max | 99.000000 | 114.000000 | 39.000000 | 69.000000 | |
| 108-96 | count | 105.000000 | 112.000000 | 105.000000 | 112.000000 |
| mean | -13.714286 | -13.232143 | 11.161905 | 10.580357 | |
| std | 27.040822 | 24.782652 | 19.730942 | 27.504181 | |
| min | -95.000000 | -74.000000 | -32.000000 | -185.000000 | |
| 25% | -28.000000 | -26.000000 | 0.000000 | 0.000000 | |
| 50% | -3.000000 | -5.000000 | 5.000000 | 8.000000 | |
| 75% | 3.000000 | 1.000000 | 20.000000 | 17.250000 | |
| max | 48.000000 | 50.000000 | 91.000000 | 121.000000 | |
| 120-108 | count | 105.000000 | 112.000000 | 105.000000 | 112.000000 |
| mean | 29.009524 | 25.250000 | 16.600000 | 18.125000 | |
| std | 28.919815 | 28.640204 | 23.212066 | 26.589683 | |
| min | -49.000000 | -26.000000 | -25.000000 | -47.000000 | |
| 25% | 8.000000 | 2.750000 | 0.000000 | 2.750000 | |
| 50% | 24.000000 | 14.500000 | 10.000000 | 12.000000 | |
| 75% | 47.000000 | 41.250000 | 24.000000 | 28.250000 | |
| max | 99.000000 | 99.000000 | 94.000000 | 174.000000 | |
| revisions | count | 105.000000 | 115.000000 | 105.000000 | 117.000000 |
| mean | 8.371429 | 8.391304 | 7.619048 | 7.777778 | |
| std | 1.475812 | 1.309182 | 1.589515 | 1.509231 | |
| min | 0.000000 | 1.000000 | 0.000000 | 0.000000 | |
| 25% | 8.000000 | 8.000000 | 7.000000 | 7.000000 | |
| 50% | 9.000000 | 9.000000 | 8.000000 | 8.000000 | |
| 75% | 9.000000 | 9.000000 | 9.000000 | 9.000000 | |
| max | 9.000000 | 9.000000 | 9.000000 | 9.000000 | |
plt.subplots()
exp['revisions'][(exp['participant.inflation'] == '1012') & (
exp['participant.day'] < 3
)].hist(color='r', label='10x12 pre-intervention')
exp['revisions'][(exp['participant.inflation'] == '1012') & (
exp['participant.day'] >= 3
)].hist(color='b', alpha = 0.4, label='10x12 post-intervention')
plt.legend(loc='upper left')
plt.subplots()
exp['revisions'][(exp['participant.inflation'] == '430') & (
exp['participant.day'] < 3
)].hist(color='r', label='4x30 pre-intervention')
exp['revisions'][(exp['participant.inflation'] == '430') & (
exp['participant.day'] >= 3
)].hist(color='b', alpha = 0.4, label='4x30 post-intervention')
plt.legend(loc='upper left')
<matplotlib.legend.Legend at 0x2422f4f1730>
cols = [c for c in exp.columns.to_list() if ('task.' not in c) and ('.day' not in c)]
exp[cols].groupby(['participant.inflation', exp['participant.day'] < 3]).describe().T
| participant.inflation | 1012 | 430 | |||
|---|---|---|---|---|---|
| participant.day | False | True | False | True | |
| 24-12 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | 4.914286 | 16.752212 | 2.095238 | -1.026786 | |
| std | 25.220228 | 22.193762 | 10.407582 | 15.098750 | |
| min | -105.000000 | -27.000000 | -24.000000 | -45.000000 | |
| 25% | -3.000000 | 2.000000 | 0.000000 | -4.250000 | |
| 50% | 3.000000 | 8.000000 | 1.000000 | 0.000000 | |
| 75% | 12.000000 | 26.000000 | 4.000000 | 2.000000 | |
| max | 89.000000 | 95.000000 | 57.000000 | 106.000000 | |
| 36-24 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | 4.961905 | -3.752212 | 2.990476 | 9.857143 | |
| std | 22.217857 | 21.998186 | 16.688605 | 15.200674 | |
| min | -59.000000 | -110.000000 | -66.000000 | -35.000000 | |
| 25% | -1.000000 | -11.000000 | -1.000000 | 0.750000 | |
| 50% | 1.000000 | 0.000000 | 2.000000 | 7.000000 | |
| 75% | 12.000000 | 6.000000 | 9.000000 | 17.000000 | |
| max | 106.000000 | 61.000000 | 66.000000 | 68.000000 | |
| 48-36 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | -1.542857 | 2.955752 | 2.247619 | 2.178571 | |
| std | 20.794336 | 16.102013 | 14.671913 | 15.858163 | |
| min | -66.000000 | -49.000000 | -43.000000 | -75.000000 | |
| 25% | -7.000000 | -3.000000 | -1.000000 | -4.250000 | |
| 50% | 1.000000 | 3.000000 | 1.000000 | 3.000000 | |
| 75% | 8.000000 | 12.000000 | 9.000000 | 12.000000 | |
| max | 74.000000 | 55.000000 | 57.000000 | 36.000000 | |
| 60-48 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | 4.019048 | 2.522124 | 5.028571 | 8.017857 | |
| std | 23.030490 | 22.377483 | 19.515505 | 20.558413 | |
| min | -69.000000 | -72.000000 | -71.000000 | -96.000000 | |
| 25% | -5.000000 | -8.000000 | -1.000000 | -1.250000 | |
| 50% | 0.000000 | 0.000000 | 3.000000 | 3.000000 | |
| 75% | 10.000000 | 8.000000 | 10.000000 | 17.250000 | |
| max | 71.000000 | 100.000000 | 82.000000 | 65.000000 | |
| 72-60 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | -1.904762 | -1.646018 | -4.152381 | -5.517857 | |
| std | 19.376097 | 21.904387 | 19.614938 | 20.719483 | |
| min | -66.000000 | -77.000000 | -93.000000 | -78.000000 | |
| 25% | -7.000000 | -7.000000 | -9.000000 | -15.000000 | |
| 50% | 1.000000 | 0.000000 | -2.000000 | -1.500000 | |
| 75% | 8.000000 | 5.000000 | 2.000000 | 4.500000 | |
| max | 57.000000 | 65.000000 | 62.000000 | 42.000000 | |
| 84-72 | count | 105.000000 | 113.000000 | 105.000000 | 112.000000 |
| mean | 5.666667 | 3.415929 | 1.980952 | -1.901786 | |
| std | 19.741925 | 21.775939 | 15.160666 | 16.515873 | |
| min | -29.000000 | -58.000000 | -50.000000 | -54.000000 | |
| 25% | -5.000000 | -4.000000 | -4.000000 | -8.000000 | |
| 50% | 0.000000 | 1.000000 | 0.000000 | 0.000000 | |
| 75% | 9.000000 | 10.000000 | 5.000000 | 5.000000 | |
| max | 66.000000 | 80.000000 | 58.000000 | 45.000000 | |
| 96-84 | count | 105.000000 | 112.000000 | 105.000000 | 112.000000 |
| mean | -3.476190 | -1.839286 | 0.314286 | 3.267857 | |
| std | 24.493365 | 26.953598 | 16.731657 | 17.780434 | |
| min | -67.000000 | -94.000000 | -84.000000 | -63.000000 | |
| 25% | -7.000000 | -13.250000 | -3.000000 | -2.000000 | |
| 50% | 0.000000 | 0.000000 | 1.000000 | 3.000000 | |
| 75% | 6.000000 | 8.250000 | 6.000000 | 12.000000 | |
| max | 99.000000 | 63.000000 | 45.000000 | 69.000000 | |
| 108-96 | count | 105.000000 | 112.000000 | 105.000000 | 112.000000 |
| mean | 8.419048 | 4.616071 | 8.380952 | 5.696429 | |
| std | 25.232298 | 24.659938 | 16.802233 | 26.788070 | |
| min | -95.000000 | -66.000000 | -28.000000 | -183.000000 | |
| 25% | -2.000000 | -5.000000 | -1.000000 | -1.250000 | |
| 50% | 3.000000 | 2.000000 | 5.000000 | 1.500000 | |
| 75% | 16.000000 | 11.000000 | 13.000000 | 14.250000 | |
| max | 70.000000 | 99.000000 | 85.000000 | 72.000000 | |
| revisions | count | 105.000000 | 115.000000 | 105.000000 | 117.000000 |
| mean | 7.171429 | 7.391304 | 6.942857 | 7.094017 | |
| std | 1.369005 | 1.226145 | 1.343278 | 1.383293 | |
| min | 0.000000 | 2.000000 | 0.000000 | 1.000000 | |
| 25% | 7.000000 | 7.000000 | 7.000000 | 7.000000 | |
| 50% | 8.000000 | 8.000000 | 7.000000 | 8.000000 | |
| 75% | 8.000000 | 8.000000 | 8.000000 | 8.000000 | |
| max | 8.000000 | 8.000000 | 8.000000 | 8.000000 | |
df = final_df_dict['decision'].copy()
cols = [c for c in df.columns.to_list() if 'task.' in c]
df[cols] = df[cols].astype(float)
fig, ax = plt.subplots(figsize=(30,30))
df1 = df[cols][(df['participant.inflation'] == '1012') & (
df['participant.day'] < 3)]
df1.hist(ax=ax, bins=20, color='r', label='pre')
plt.legend(loc='upper left')
fig, ax = plt.subplots(figsize=(30,30))
df1 = df[cols][(df['participant.inflation'] == '1012') & (
df['participant.day'] >= 3)]
df1.hist(ax=ax, bins=20, color='b', label='post')
plt.legend(loc='upper left')
fig, ax = plt.subplots(figsize=(30,30))
df1 = df[cols][(df['participant.inflation'] == '430') & (
df['participant.day'] < 3)]
df1.hist(ax=ax, bins=20, color='r', label='pre')
plt.legend(loc='upper left')
fig, ax = plt.subplots(figsize=(30,30))
df1 = df[cols][(df['participant.inflation'] == '430') & (
df['participant.day'] >= 3)]
df1.hist(ax=ax, bins=20, color='b', label='post')
plt.legend(loc='upper left')
No handles with labels found to put in legend. No handles with labels found to put in legend. No handles with labels found to put in legend. No handles with labels found to put in legend.
<matplotlib.legend.Legend at 0x2422e88cc40>